<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
  xmlns:o="urn:schemas-microsoft-com:office:office"
  xmlns:x="urn:schemas-microsoft-com:office:excel"
  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
  xmlns:html="http://www.w3.org/TR/REC-html40">
  <ss:Styles>
       <ss:Style ss:ID="table">
         <ss:Alignment ss:Horizontal="Center" ss:Vertical="Center">
         </ss:Alignment>
       </ss:Style>
  </ss:Styles>
  <Worksheet ss:Name="Sheet1">
    <Table ss:DefaultColumnWidth ="100" ss:DefaultRowHeight="25" ss:StyleID="table">
        <Column ss:Index="1" ss:AutoFitWidth="0" ss:Width="150"/>
      <Row>
        <Cell ss:MergeAcross="10"><Data ss:Type="String">领取优惠卷的信息</Data></Cell>
      </Row>
      <Row>
        <Cell><Data ss:Type="String">优惠卷名称</Data></Cell>
        <Cell><Data ss:Type="String">编码</Data></Cell>
        <Cell><Data ss:Type="String">用户名</Data></Cell>
        <Cell><Data ss:Type="String">电话号码</Data></Cell>
        <Cell><Data ss:Type="String">会员状态</Data></Cell>
        <Cell><Data ss:Type="String">宠物</Data></Cell>
        <Cell><Data ss:Type="String">宠物日期</Data></Cell>
        <Cell><Data ss:Type="String">省</Data></Cell>
        <Cell><Data ss:Type="String">市</Data></Cell>
        <Cell><Data ss:Type="String">地区</Data></Cell>
        <Cell><Data ss:Type="String">地址</Data></Cell>
      </Row>
        <% @coupons.each do |coupon| %>
        <% user = coupon.user  %>
        <% if user %>
        <Row>
          <Cell><Data ss:Type="String"><%= coupon.name %></Data></Cell>
          <Cell><Data ss:Type="String"><%= coupon.code %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.name %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.phone %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.activated ? '是' : '否' %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.pets %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.pet_birth %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.address.province  if user.address %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.address.city if user.address  %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.address.district if user.address  %></Data></Cell>
          <Cell><Data ss:Type="String"><%= user.address.street if user.address  %></Data></Cell>
        </Row>
        <% end %>
    <% end %>
   </Table>
  </Worksheet>
</Workbook>
